package org.shiki.hrm.feign;

import feign.hystrix.FallbackFactory;
import org.shiki.hrm.doc.CourseDoc;
import org.shiki.hrm.domain.Course;
import org.shiki.hrm.query.CourseDocQuery;
import org.shiki.hrm.util.AjaxResult;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Component
public class CourseDocFallbackFatory implements FallbackFactory<CourseDocFeignClient> {

	@Override
	public CourseDocFeignClient create(Throwable throwable) {
		return new CourseDocFeignClient() {

			@Override
			public AjaxResult onLineCourse(List<CourseDoc> list) {
				return AjaxResult.me().setSuccess(false).setMessage("上线失败!");
			}

			@Override
			public AjaxResult offLineCourse(List<CourseDoc> list) {
				return AjaxResult.me().setSuccess(false).setMessage("下线失败!");
			}

			@Override
			public AjaxResult queryCourses(CourseDocQuery query) {
				return AjaxResult.me().setSuccess(false).setMessage("网络异常!");
			}
		};
	}
}
